package pt.fct.mpc.lastfm.event;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import android.util.Log;

import com.google.android.maps.GeoPoint;

public class EventData implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -854157620316272685L;

	private static final String TAG = "Last.fm Event Data";
	
	private String id = "";	
	private String venue_name = "";
	private String city = "";
	private String country = "";
	private String date = "";
	private String image_small = "";
	private String image_medium = "";
	private String image_large = "";
	private String image_extralarge = "";
	private String geo_lat = "";
	private String geo_long = "";
	private String title = "";
	private List<String> artists = new LinkedList<String>();
	private String headliner = null;

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id += id;
	}
	public String getVenue_name() {
		return venue_name;
	}
	public void setVenue_name(String venueName) {
		venue_name += venueName;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city += city;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country += country;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date += date;
	}
	public String getImage_small() {
		return image_small;
	}
	public void setImage_small(String imageSmall) {
		image_small += imageSmall;
	}
	public String getImage_medium() {
		return image_medium;
	}
	public void setImage_medium(String imageMedium) {
		image_medium += imageMedium;
	}
	public String getImage_large() {
		return image_large;
	}
	public void setImage_large(String imageLarge) {
		image_large += imageLarge;
	}
	public String getImage_extralarge() {
		return image_extralarge;
	}
	public void setImage_extralarge(String imageExtralarge) {
		image_extralarge += imageExtralarge;
	}
	public String getGeo_lat() {
		return geo_lat;
	}
	public void setGeo_lat(String geoLat) {
		geo_lat += geoLat;
	}
	public String getGeo_long() {
		return geo_long;
	}
	public void setGeo_long(String geoLong) {
		geo_long += geoLong;
	}
	
	public GeoPoint getGeoPoint()
	{
		if ((this.geo_lat == null) || (this.geo_long == null))
		{
			Log.d(TAG, "Event's GeoPoint has null values: "
				+"lat = "+this.geo_lat+", lng = "+this.geo_long);
			return null;
		}
		
		double lat = Double.parseDouble(this.geo_lat);
		double lng = Double.parseDouble(this.geo_long);
		
		return new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
	}
	
	public void setTitle(String string)
	{
		this.title += string;
	}
	
	public String getTitle()
	{
		return this.title;
	}
	
	public void setHeadliner(String artist)
	{
		this.headliner = artist;
	}
	
	public String getHeadliner()
	{
		return this.headliner;
	}
	
	public void addArtist(String artist)
	{
		this.artists.add(artist);
	}
	
	public List<String> getArtists()
	{
		return this.artists;
	}
	
	public String getArtist()
	{
		if (this.headliner != null)
			return this.headliner;
		else
		{
			if ((this.artists != null) && (this.artists.size() > 0))
				return this.artists.get(0);
		}
		
		return "";
	}
}